package com.ncucoder.soms.service.impl;

import com.ncucoder.soms.dao.RoleMapper;
import com.ncucoder.soms.entity.Role;
import com.ncucoder.soms.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author <a href="https://www.ncucoder.com">hsowan</a>
 * @date 2019-07-06
 **/
@Service
public class RoleServiceImpl implements RoleService {

    @Autowired
    private RoleMapper roleMapper;

    @Override
    public int createRole(Role role) {
        if (role.getName() != null) {
            return roleMapper.insert(role);
        } else {
            return -1;
        }
    }

    @Override
    public int deleteRole(Long roleId) {
        return roleMapper.deleteById(roleId);
    }

    @Override
    public void correlationPermissions(Long roleId, List<Long> permissionIds) {

    }

    @Override
    public void uncorrelationPermissions(Long roleId, List<Long> permissionIds) {

    }
}
